#include <stdio.h>
void hanno(int n, char A, char B, char C)
{
    if (n == 1)
    {
        printf("Move disk %d from %c to %c\n", n, A, C);
        return;
    }
    hanno(n - 1, A, C, B);
    printf("Move disk %d from %c to %c\n", n, A, C);
    hanno(n - 1, B, A, C);
}
int main()
{
    int n;
    scanf("%d", &n);
    hanno(n, 'A', 'B', 'C');
    return 0;
}